﻿
// DBBrowserView.h: CDBBrowserView 类的接口
//

#pragma once

class CDBListCtrl : public CListCtrl
{
public:
	CDBListCtrl(){}
	virtual ~CDBListCtrl(){}
	CEdit	m_Edit;
	int pageIndex = -1;
	int iItemIndex = -1;
	int ItemIndex = 0;
	int iSubItem = -1;
	int hotkey = 0;
	bool errcode = 0;
	std::string errtext = "";
	CString ItemText;

protected:
	afx_msg void OnEnKillfocusEdit1();
	afx_msg void OnTimer(UINT_PTR nIDEvent);
	afx_msg void OnHotKey(UINT nHotKeyId, UINT nKey1, UINT nKey2);
	DECLARE_MESSAGE_MAP()
};

class CDBBrowserView : public CView
{
protected: // 仅从序列化创建
	CDBBrowserView() noexcept;
	DECLARE_DYNCREATE(CDBBrowserView)

// 特性
public:
	CDBBrowserDoc* GetDocument() const;

// 操作
public:

// 重写
public:
	virtual void OnDraw(CDC* pDC);  // 重写以绘制该视图
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:

// 实现
public:
	virtual ~CDBBrowserView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
	
// 生成的消息映射函数
protected:
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnGetdispinfoList1(NMHDR * pNMHDR, LRESULT * pResult);
	afx_msg void OnEndscrollList1(NMHDR * pNMHDR, LRESULT * pResult);
	afx_msg void OnClickkList1(NMHDR * pNMHDR, LRESULT * pResult);
	afx_msg void OnDblclkList1(NMHDR * pNMHDR, LRESULT * pResult);
	afx_msg void OnColumnclickList1(NMHDR * pNMHDR, LRESULT * pResult);
	afx_msg void OnItemChangedList1(NMHDR * pNMHDR, LRESULT * pResult);
	afx_msg void OnTimer(UINT_PTR nIDEvent);
	DECLARE_MESSAGE_MAP()
public:
	CDBListCtrl		m_List;
	struct _FOCUSCELL
	{
		int iItem = 0;
		int iSubItem = 0;
		bool changed = false;
	} m_focus;

public:
	virtual void OnInitialUpdate();
	void ReFresh();
	void UpdateRichEdit();
	void AdjustListWidth();
	void EditCell(int iItem, int iSubItem);
	afx_msg void OnDropFiles(HDROP hDropInfo);
};

#ifndef _DEBUG  // DBBrowserView.cpp 中的调试版本
inline CDBBrowserDoc* CDBBrowserView::GetDocument() const
   { return reinterpret_cast<CDBBrowserDoc*>(m_pDocument); }
#endif

